<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="product" tagdir="/WEB-INF/tags/product"%>
<%@ taglib prefix="customer" tagdir="/WEB-INF/tags/customer"%>

<form class="mainForm" name="entityListForm" method="post" id="entityListForm" action="${ctxPath}/customer/consult.html">
	<c:set var="editURLPath"	value="/customer/consult.html?doAction=edit&from=list" scope="page" />
	<div class="top clearfix">
		<ul class="tab">
			<li class="curr"><span><fmt:message key="consultList.heading"/></span></li>
		</ul>
		<%@include file="/common/pagingOnlyTop.jsp"%>
	</div>
	<div class="data">		
		<c:set var="checkAll">
			<input type="checkbox" name="allbox" onclick="checkAll(this.form)"	class="checkbox" />
		</c:set>
		<c:set var="isNeedTopPaging" value="true"/>
		
		<table id="consult" width="100%" border="0" cellspacing="0" cellpadding="0" class="list_table">	
			<tr>
			  	<th width="20"><input onclick="checkAll(this.form)" name="allbox" type="checkbox" value="" /></th>	
				<th style="width:20px;">
					<span class="expand" onclick="toggleScreenAll(this)">&nbsp;</span>
				</th>
				<th class='sortable ${(consultSearchCriteria.orderby eq 3)?"sorted order1":((consultSearchCriteria.orderby eq 4)?"sorted order2":"")}'>	
					<a onclick="sortField(this,3,4)"><fmt:message key="consult.message" /></a>
				</th>
				<th style="width:12%" class='sortable ${(consultSearchCriteria.orderby eq 9)?"sorted order1":((consultSearchCriteria.orderby eq 10)?"sorted order2":"")}'>
					<a onclick="sortField(this,9,10)"><fmt:message key="consult.createTime" /></a>
				</th>
				<th style="width:16%" class='sortable ${(consultSearchCriteria.orderby eq 5)?"sorted order1":((consultSearchCriteria.orderby eq 6)?"sorted order2":"")}'>
					<a onclick="sortField(this,5,6)"><fmt:message key="consult.productName" /></a>
				</th>
				<th style="width:8%">
					<span><fmt:message key="consult.consultUser" /></span>
				</th>
				<th  style="width:12%">
					<span><fmt:message key="consult.display" /></span>
				</th>
			</tr>
			<c:forEach var="consult" items="${consultList}" varStatus="status">
				<tr id="tr${consult.consultId}" consultId="${consult.consultId}" class="${(status.index%2==0)?'even':'odd'}">
					<td>
						<input type="checkbox" name="multiIds"	value="${consult.consultId}" class="checkbox"	title="${consult.message}" />
					</td>
					<td>
						 <span class="expand toggleScreen" onclick="toggleScreen(this)">&nbsp;</span>  
					</td>
					<td>	                   
						${consult.message}
					</td>
					<td>
						<common:datetimeFormat date="${consult.createTime}"/>
					</td>
					<td>
						${consult.product.productName}
					</td>
					<td>
						${consult.consultUserName}
					</td>
					<td>
						<span class="${(consult.status == 1)?'show':'unShow'}" title="<fmt:message key="consult.status.${(consult.status == 1)?'show':'unShow'}"/>">&nbsp;</span>
						<span id="readStatus_${consult.consultId}" class="${(consult.isRead == 1)?'read':'unRead'}" title="<fmt:message key="consult.isRead.${(consult.isRead == 1)?'read':'unRead'}"/>">&nbsp;</span>
						<span id="handleStatus_${consult.consultId}" class="${(consult.onShowReplyCount >= 1)?'handle':'unHandle'}" title="<fmt:message key="consult.isHandle.${(consult.onShowReplyCount >= 1)?'handle':'unHandle'}"/>">&nbsp;</span>
					</td>
				</tr>
				<tr style="display: none;"  class="${(status.index%2==0)?'even':'odd'} sub">
					<td></td>
					<td class="consignee" colspan="10">
						<div class="order_show">
							<table cellspacing="0" cellpadding="0" border="0" width="100%">
								<tr>
									<td class="consignee">
										<table cellspacing="0" cellpadding="0" border="0" width="100%" class="consignee_table">
											<tr>
												<th width="100px;"><fmt:message key="consult.product"/>:</th>
												<td>
													<authorize:authorizeResource resourceString="/product/prod*">
														<c:set var="isAuth" value="true"/>
													</authorize:authorizeResource>
													<c:choose>
														<c:when test="${isAuth}">
															<product:productImage product="${consult.product}" sizeType="s1" />
														</c:when>
														<c:otherwise>
															<product:productImage product="${consult.product}" sizeType="s1" linkType="0" />
														</c:otherwise>
													</c:choose>
													<c:set var="isAuth" value="false"/>
												</td>
											</tr>
											<tr>
												<th><fmt:message key="consult.consultUser"/>:</th>
												<td>${consult.consultUserName}</td>
											</tr>
											<tr>
												<th><fmt:message key="consult.createTime"/>:</th>
												<td><fmt:formatDate value="${consult.createTime}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
											</tr>
											<tr>
												<th><fmt:message key="consult.remoteIp"/>:</th>
												<td>${consult.remoteIp}</td>
											</tr>
											<tr>
												<th><fmt:message key="consult.address"/>:</th>
												<td>${consult.address}</td>
											</tr>
										</table>
									</td>
									<td style="vertical-align:top;">
										<table cellspacing="0" cellpadding="0" border="0" width="100%" class="consignee_table" id="replyDiv_${consult.consultId}">
											<tr>
												<th width="100px;"><fmt:message key="consult.message"/>:</th>
												<td>${consult.message}</td>
											</tr>
											<tr>
												<th><fmt:message key="consult.replySituation"/>:</th>
												<td>
													<fmt:message key="consult.replySituation.body.1"/>
													<span class="replyCount" id="replyCount_${consult.consultId}">(${consult.onShowReplyCount}/${consult.replyCount})</span>
													&nbsp;<a href="javascript:void(0)" onclick="showDialogOfreplyDialog(${consult.consultId})"><b><fmt:message key="consult.replySituation.body.2"/></b></a>
													
													<span style="float:right">
														<a class="useful" style="cursor:text;">&nbsp;</a><fmt:message key="consult.satisfied"/>(${consult.satisfiedCount})
														&nbsp;<a class="unuseful" style="cursor:text;">&nbsp;</a><fmt:message key="consult.unsatisfied"/>(${consult.unsatisfiedCount})
													</span>
												</td>
											</tr>
											<tr>
												<th><fmt:message key="consult.replySituation.byAdministrator"/>:</th>
												<td>
													<span><textarea id="message_${consult.consultId}" name="replyMessage" style="width:500px;height:100px;" class="textareatxt"></textarea></span>
													<br/><input type="button" class="btn3" value="<fmt:message key="consult.button.reply"/>" onclick="replyConsult(${consult.consultId})"/>
													<input type="hidden" name="consultId" value="${consult.consultId}"/>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</div>
					</td>
				</tr>	
			</c:forEach>
			<c:if test="${empty consultList}">
				<tr>
					<td colspan="6" style="text-align:center">
						<fmt:message key="consultList.empty"/>
					</td>
				</tr>
			</c:if>
		</table>	
		<%@include file="/common/pagingOnly.jsp" %>
	</div>
</form>
<%--------保存查询条件 -------%>
<%@include file="consultSearchCriteriaStorage.jspf"%>

<script type="text/javascript">
$j(document).ready(function () {
	highlightTableRows("consult");
});
</script>